home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / bash_completion.d / gpg2 < prev    next >
Encoding:
Text File  |  2010-11-16  |  1.4 KB  |  53 lines

  1. # gpg2(1) completion
  2.  
  3. have gpg2 && {
  4. _gpg2 ()
  5. {
  6.     local cur prev
  7.  
  8.     COMPREPLY=()
  9.     _get_comp_words_by_ref cur prev
  10.  
  11.     case $prev in
  12.         --homedir)
  13.             _filedir -d
  14.             return 0
  15.             ;;
  16.         -s|--sign|--clearsign|--options|--decrypt)
  17.             _filedir
  18.             return 0
  19.             ;;
  20.         --export|--sign-key|--lsign-key|--nrsign-key|--nrlsign-key|--edit-key)
  21.             # return list of public keys
  22.             COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \
  23.                 sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p' \
  24.                     -ne 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) )
  25.             return 0
  26.             ;;
  27.         -r|--recipient)
  28.             COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \
  29.                 sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
  30.             if [ -e ~/.gnupg/gpg.conf ]; then
  31.                 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne \
  32.                     's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
  33.                     ~/.gnupg/gpg.conf)" -- "$cur"))
  34.             fi
  35.         return 0
  36.         ;;
  37.     esac
  38.  
  39.     if [[ "$cur" == -* ]]; then
  40.         COMPREPLY=( $( compgen -W '$(gpg2 --dump-options)' -- "$cur" ) )
  41.     fi
  42. } &&
  43. complete -F _gpg2 -o default gpg2
  44. }
  45.  
  46. # Local variables:
  47. # mode: shell-script
  48. # sh-basic-offset: 4
  49. # sh-indent-comment: t
  50. # indent-tabs-mode: nil
  51. # End:
  52. # ex: ts=4 sw=4 et filetype=sh
  53.